import { View } from "../../../mvc/core/View";
import { ObjCreate } from "../common/ObjCreate";
import { ResFileConst } from "../../resource/ResFileConst";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { WardrobeType } from "./WardrobeType";
import { EMergeType } from "../../../../Message/Public/EMergeType";
import { Language } from "../../../../extend/language/Language";
import { Cache } from "../../cache/Cache";
import { ItemData } from "../../resource/info/ItemData";
import { EquipmentItemDataUtil } from "../common/EquipmentItemDataUtil";
import { MergeConfig } from "../../resource/MergeConfig";
import { GLoadedButton } from "../../../../com/mui/controls/GLoadedButton";
type int = number;
//class MergeLevelBtn
    
    export  class MergeLevelBtn extends View
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this._mergeLevelBtn = ObjCreate.createGLoadedButton(ResFileConst.MergeBtn, 0, 0, 31, 26, this);
            this._levelTxt = ObjCreate.createTextField("", 0, 26, 50, 20, this, GlobalStyle.textFormat6);
            return;
        }

        public updateTips(arg1: int): void
        {
            var loc1=0;
            var loc5=null;
            var loc6=null;
            var loc7=null;
            var loc8=null;
            var loc9=null;
            var loc10=null;
            var loc11=0;
            var loc12=undefined;
            var loc13=0;
            var loc2="";
            if (arg1 != WardrobeType.WardrobeFashion) 
            {
                if (arg1 != WardrobeType.WardrobeFashionWeapon) 
                {
                    if (arg1 != WardrobeType.WardrobeWing) 
                    {
                        if (arg1 != WardrobeType.WardrobeFootPrint) 
                        {
                            if (arg1 != WardrobeType.WardrobeBubble) 
                            {
                                if (arg1 != WardrobeType.WardrobeSurroung) 
                                {
                                    if (arg1 != WardrobeType.WardrobeWaistBelt) 
                                    {
                                        if (arg1 == WardrobeType.WardrobeElf) 
                                        {
                                            loc1 = EMergeType._EMergeTypeElf;
                                            loc2 = Language.getString(74721);
                                        }
                                    }
                                    else 
                                    {
                                        loc1 = EMergeType._EMergeTypeWaistBelt;
                                        loc2 = Language.getString(74701);
                                    }
                                }
                                else 
                                {
                                    loc1 = EMergeType._EMergeTypeSurround;
                                    loc2 = Language.getString(71461);
                                }
                            }
                            else 
                            {
                                loc1 = EMergeType._EMergeTypeBubble;
                                loc2 = Language.getString(71444);
                            }
                        }
                        else 
                        {
                            loc1 = EMergeType._EMergeTypeFootprint;
                            loc2 = Language.getString(71402);
                        }
                    }
                    else 
                    {
                        loc1 = EMergeType._EMergeTypeWing;
                        loc2 = Language.getString(36201);
                    }
                }
                else 
                {
                    loc1 = EMergeType._EMergeTypeWeaponFashion;
                    loc2 = Language.getString(36202);
                }
            }
            else 
            {
                loc1 = EMergeType._EMergeTypeFashion;
                loc2 = Language.getString(36200);
            }
            var loc3="<textFormat leading=\'3\'>";
            var loc4=Cache.instance.wardrobe.getMergeLevelItemData(arg1);
            this._levelTxt.text = "LV·" + loc4.length;
            if (loc4 && loc4.length <= 0) 
            {
                loc3 = (loc3 = Language.getString(36210) + "\n") + Language.getStringByParam(36211, loc2);
            }
            else if (loc4) 
            {
                loc3 = (loc3 = loc3 + "<font color=\'#ffff00\' size=\'16\'>" + Language.getString(36212) + loc4.length + "</font>\n") + "<font color=\'#00ff00\'>" + Language.getString(36213) + "</font>\n";
                loc9 = new Map<any, any> /* flash.utils.Dictionary */();
                loc10 = [];
                loc11 = 0;
                while (loc11 < loc4.length) 
                {
                    loc5 = loc4[loc11] as ItemData;
                    loc7 = (loc6 = new EquipmentItemDataUtil(loc5)).getBasePropArray(false);
                    loc13 = 0;
                    while (loc13 < loc7.length) 
                    {
                        loc8 = loc7[loc13];
                        if (loc9[loc8.name] != null) 
                        {
                            loc9[loc8.name] = loc9[loc8.name] + loc8.value * MergeConfig.instance.getFactorByType(loc1, loc5.color) / 100;
                        }
                        else 
                        {
                            loc9[loc8.name] = loc8.value * MergeConfig.instance.getFactorByType(loc1, loc5.color) / 100;
                        }
                        ++loc13;
                    }
                    ++loc11;
                }
                var loc14=0;
                var loc15=loc9;
                for (loc12 in loc15) 
                {
                    loc3 = loc3 + loc12 + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + Math.floor(loc9[loc12]) + "\n";
                }
                loc3 = loc3 + Language.getStringByParam(36211, loc2);
            }
            this._mergeLevelBtn.toolTipData = loc3 + "</textFormat>";
            return;
        }

        /* internal */ /* var */_mergeLevelBtn: GLoadedButton;

        /* internal */ /* var */_levelTxt: Object /* flash.text.TextField */;
    }
